package com.own.business.system.menu.entity.bo;

import com.own.business.system.menu.entity.po.SystemRole;
import com.own.component.common.base.entity.BaseBo;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

/**
 * SystemRoleBo
 *
 * @author chenxueli
 * @date 2024-03-31 09:22:58
 */
@Schema(title = "系统角色" + ConstantBeanSuffix.BO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class SystemRoleBo extends BaseBo<SystemRole> implements Serializable {

    /**
     * 角色名称
     */
    private String name;

    /**
     * 客户端id
     */
    private String clientId;

    /**
     * 是否禁用 1=禁用 0=可用
     */
    private Integer isDisable;

    /**
     * 权限列表
     */
    private List<SystemRolePermissionBo> permissions;

    /**
     * 转持久化对象
     *
     * @param entity 原持久化对象
     * @return 持久化对象
     */
    @Override
    public SystemRole toPo(SystemRole entity) {
        if (entity == null) {
            entity = new SystemRole();
        }
        entity.setName(this.name);
        entity.setClientId(this.clientId);
        entity.setIsDisable(this.isDisable);
        return super.toPo(entity);
    }

}

